from selenium import webdriver
# # 获取当前浏览器的User-Agent
# driver=webdriver.Edge()
# # driver=webdriver.Chrome()
# # driver=webdriver.Firefox()
#
# user_agent = driver.execute_script("return navigator.userAgent;")
# if 'Chrome' in user_agent:
#     print("当前使用Chrome浏览器")
# elif 'Firefox' in user_agent:
#     print("当前使用Firefox浏览器")
# elif 'Edge' in user_agent:
#     print("当前使用Edge浏览器")
#
#
# def d_b(driver):
#     try:
#         driver.execute_script('window.chrome={}')
#         return 'chrome'
#     except:
#         try:
#             driver.execute_script("return InstallTrigger !== undefined;")  # Firefox特有
#             return "Firefox"
#         except:
#             return "Unknown"
import pytest

@pytest.fixture(params=['chrome', 'firefox'])
def browser(request):
    if request.param == 'chrome':
        return webdriver.Chrome()
    else:
        return webdriver.Firefox()

